Skip to content

fix: electric-indent-mode caused too many treesit-ready-p calls #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 20, 2025

Conversation

shfx
Copy link
Contributor

@shfx shfx commented Jul 10, 2025

When electric-indent-mode was enabled, it called treesit-language-at-point-function that later called treesit-ready-p too many times.

I've created a memoization function that uses buffer local alist to store value of treesit-ready-p. This should cover the case when we have all the needed grammars for one buffer but for some reason we don't have it in another one.

Maybe there is no need for that memoization to be buffer local.

Also I tried suggestion from #9 but ended up using a separate function that can be used outside derived mode declaration.

Fixes #9

@shfx
Copy link
Contributor Author

shfx commented Jul 20, 2025

Any feedback @leafOfTree?

@Ziqi-Yang
Copy link
Collaborator

Sorry for the late reply. I haven't noticed the PR last week. It looks good. Thank you! <3

@Ziqi-Yang Ziqi-Yang merged commit 8a7b903 into leafOfTree:main Jul 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Slow new-line's when electic-indent-mode is enabled
2 participants